import request from '@/config/axios'
import type { Dayjs } from 'dayjs'

/** 保养类型信息 */
export interface EquipmentKeepSettingType {
  id: number // id
  keepSetting: any // 保养项设置
  name?: string // 类型名称
  cycle?: number // 周期(天)
  remind?: number // 提前提醒(天)
  status: number // 状态
  description: string // 描述
}

// 保养类型 API
export const EquipmentKeepSettingTypeApi = {
  // 查询保养类型分页
  getEquipmentKeepSettingTypePage: async (params: any) => {
    return await request.get({ url: `/business/equipment-keep-setting-type/page`, params })
  },

  // 查询所有保养类型 包含已绑定的和未绑定的
  getEquipmentKeepSettingTypeMapList: async (params: any) => {
    return await request.get({ url: `/business/equipment-keep-setting-type/mapList`, params })
  },

  // 查询保养类型详情
  getEquipmentKeepSettingType: async (id: number) => {
    return await request.get({ url: `/business/equipment-keep-setting-type/get?id=` + id })
  },

  // 新增保养类型
  createEquipmentKeepSettingType: async (data: EquipmentKeepSettingType) => {
    return await request.post({ url: `/business/equipment-keep-setting-type/create`, data })
  },

  // 修改保养类型
  updateEquipmentKeepSettingType: async (data: EquipmentKeepSettingType) => {
    return await request.put({ url: `/business/equipment-keep-setting-type/update`, data })
  },

  // 删除保养类型
  deleteEquipmentKeepSettingType: async (id: number) => {
    return await request.delete({ url: `/business/equipment-keep-setting-type/delete?id=` + id })
  },

  /** 批量删除保养类型 */
  deleteEquipmentKeepSettingTypeList: async (ids: number[]) => {
    return await request.delete({
      url: `/business/equipment-keep-setting-type/delete-list?ids=${ids.join(',')}`
    })
  },

  // 导出保养类型 Excel
  exportEquipmentKeepSettingType: async (params) => {
    return await request.download({
      url: `/business/equipment-keep-setting-type/export-excel`,
      params
    })
  },

  // 下载导入模板
  importTemplate: async () => {
    return request.download({ url: '/business/equipment-keep-setting-type/get-import-template' })
  },

  // 下载导入模板
  importTemplateBind: async () => {
    return request.download({
      url: '/business/equipment-keep-setting-type/get-import-templateBind'
    })
  },

  //维护模块的====================================================

  // 查询保养类型分页
  getEquipmentKeepSettingTypePageDamage: async (params: any) => {
    return await request.get({ url: `/Damage/equipment-keep-setting-type/page`, params })
  },

  // 查询所有保养类型 包含已绑定的和未绑定的
  getEquipmentKeepSettingTypeMapListDamage: async (params: any) => {
    return await request.get({ url: `/Damage/equipment-keep-setting-type/mapList`, params })
  },

  // 查询保养类型详情
  getEquipmentKeepSettingTypeDamage: async (id: number) => {
    return await request.get({ url: `/Damage/equipment-keep-setting-type/get?id=` + id })
  },

  // 新增保养类型
  createEquipmentKeepSettingTypeDamage: async (data: EquipmentKeepSettingType) => {
    return await request.post({ url: `/Damage/equipment-keep-setting-type/create`, data })
  },

  // 修改保养类型
  updateEquipmentKeepSettingTypeDamage: async (data: EquipmentKeepSettingType) => {
    return await request.put({ url: `/Damage/equipment-keep-setting-type/update`, data })
  },

  // 删除保养类型
  deleteEquipmentKeepSettingTypeDamage: async (id: number) => {
    return await request.delete({ url: `/Damage/equipment-keep-setting-type/delete?id=` + id })
  },

  /** 批量删除保养类型 */
  deleteEquipmentKeepSettingTypeListDamage: async (ids: number[]) => {
    return await request.delete({
      url: `/Damage/equipment-keep-setting-type/delete-list?ids=${ids.join(',')}`
    })
  },

  // 导出保养类型 Excel
  exportEquipmentKeepSettingTypeDamage: async (params) => {
    return await request.download({
      url: `/Damage/equipment-keep-setting-type/export-excel`,
      params
    })
  },

  // 下载导入模板
  importTemplateDamage: async () => {
    return request.download({ url: '/Damage/equipment-keep-setting-type/get-import-template' })
  },

  // 下载导入模板
  importTemplateBindDamage: async () => {
    return request.download({
      url: '/Damage/equipment-keep-setting-type/get-import-templateBind'
    })
  }
}
